﻿namespace EAL.Converters
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Data;
    using EAL.Models;

    public class OrderStateLocalizationConverter : BaseConverter, IValueConverter
    {
        private Dictionary<OrderState, String> _germanLookup = new Dictionary<OrderState,string>();


        public OrderStateLocalizationConverter()
        {
            //only german version
            _germanLookup[OrderState.Created] = "Erstellt";
            _germanLookup[OrderState.Processing] = "In Bearbeitung";
            _germanLookup[OrderState.Payed] = "Bezahlt";
            _germanLookup[OrderState.Sent] = "An Kunde gesendet";
            _germanLookup[OrderState.Closed] = "Abgeschlossen";
        }


        #region IValueConverter Member
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //only german version
            OrderState state = (OrderState)value;
            return _germanLookup[state];
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //only german version
            return _germanLookup.First(o => o.Value == (String)value);
        }
        #endregion
    }
}
